import { createConfigForNuxt } from '@nuxt/eslint-config/flat';
import tsParser from '@typescript-eslint/parser';
import unocss from '@unocss/eslint-config/flat';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import vuePlugin from 'eslint-plugin-vue'; // 引入 vue 插件
import vueParser from 'vue-eslint-parser';
export default createConfigForNuxt({
  features: {
    standalone: false,
    typescript: true,
    compositionApi: true,
    vue: true,
    pinia: true,
  },
})
  .append(unocss)
  .append({
    files: ['**/*.vue'],
    languageOptions: {
      parser: vueParser,
      parserOptions: {
        parser: tsParser,
        ecmaVersion: 'latest',
        sourceType: 'module',
        ecmaFeatures: {
          jsx: true,
        },
        extraFileExtensions: ['.vue'],
      },
    },
    plugins: {
      vue: vuePlugin,
    },
    rules: {
      'vue/no-multiple-template-root': 'error',
    },
  })
  .append({
    plugins: {
      'simple-import-sort': simpleImportSort,
    },
    ignores: [
      '**/dist/**',
      '**/.output/**',
      '.nuxt/**/**',
      '**/.nuxt/**',
      './.nuxt/dist/**/*',
      '**/node_modules/*',
      '**/build/**',
      '**/coverage/**',
      '**/*.d.ts', // 如果不想 lint 类型声明
      '**/*.config.ts', // 如果你不想校验配置文件
    ],
    rules: {
      'simple-import-sort/imports': 'error',
      'simple-import-sort/exports': 'error',
      'import/no-extraneous-dependencies': 'off',
      'import/extensions': 'off',
      'import/no-unresolved': 'off',
    },
  });
